//  入口函数
function inter() {
    console.log('程序启动成功！');
    upDate();
    setInterval( upDate, 1000);
}
//  调用时间库函数
function upDate() {
    const date  = new Date();
    let year    = date.getFullYear();
    let month   = addZero(date.getMonth()+1);
    let day     = addZero(date.getDate());
    let week    = '天一二三四五六'.charAt(date.getDay());
    let hours   = addZero(date.getHours());
    let minutes = addZero(date.getMinutes());
    let seconds = addZero(date.getSeconds());
    
    let yearstring = year + '年' + month + '月' + day + '日 ';
    let timestring = hours + ':' + minutes + ':' + seconds;
    let weekstring = ' 星期' + week;
    
    retureData = yearstring + timestring + weekstring;
    console.log(retureData);

    showTime(retureData);
}
//  显示时间函数
function showTime(data) {
    document.getElementById("updateTime").innerHTML = data
}
//  添零函数
function addZero(data) {
    return( data > 9 ? data : '0' + data)
}




